package org.example.leetcode;

/**
 * @author: lynn
 * @Descript:
 * @date: 2021/8/5 21:47
 * @version: 1.0
 */
public class LC334_1 {
    //fixme 找出一个数组中是否存在 n个递增/递减的数.多少个n，定义多少个if，else
    public boolean increasingTriplet(int[] nums) {
        int first=Integer.MAX_VALUE;
        int second=Integer.MAX_VALUE;
        for (int i = 0; i <nums.length; i++) {
            if (nums[i]<=first){
                first=nums[i];
            }else if (nums[i]<=second){
                second=nums[i];
            }else {
                return  true;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        LC334_1 lc=new LC334_1();
        int[] nums={2,4,-1,2,1,5};
        System.out.println(lc.increasingTriplet(nums));
    }
}
